home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 3081 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.6 KB  |  59 lines

  1. Path: maroon.tc.umn.edu!haizh001
  2. From: haizh001@maroon.tc.umn.edu (Haizhou Chen)
  3. Newsgroups: comp.lang.c++
  4. Subject: Help: Borland C++ 4.52 Link Problem
  5. Date: 21 Jan 1996 22:31:06 -0600
  6. Organization: University of Minnesota
  7. Message-ID: <haizh001.822284224@maroon.tc.umn.edu>
  8. NNTP-Posting-Host: maroon.tc.umn.edu
  9.  
  10. Hi, I am having problem linking my C++ code with library or object file.
  11. Here is an example:
  12.  
  13. ---------------mytest.cpp---------------------
  14. #include <iostream.h>
  15.  
  16. void mytest( int i)
  17. { int j;
  18.   cout << "Please enter an integer:"
  19.   cin >> j:
  20.   cout << i*j << endl;
  21. }
  22.  
  23. ------------------end of mytest.cpp--------------
  24.  
  25. I created a library mytest.lib with this file.
  26.  
  27. Then in the main file:
  28.  
  29. ----------- proj0001.cpp--------------------
  30. extern void mytest(int);
  31.  
  32. main()
  33. { mytest(2);
  34.   return 0;
  35. }
  36.  
  37. ---------------- end of proj0001.cpp ------------------
  38.  
  39. I created a project of EasyWin with two nodes: proj0001.cpp and mytest.lib
  40. Then I tried to build the project. There wasn't any compilation error. But
  41. the linker complains:
  42.  
  43. Compiling PROJ0001.CPP:
  44. Linking target.exe:
  45. Linker Warning: No module definition file specified: using defaults
  46. Linker Error: Undefined symbol ostream::outstr(const char near*,const char near*) in module mytest.cpp
  47. Linker Error: Undefined symbol endl(ostream near&) in module mytest.cpp
  48. Linker Error: Undefined symbol istream::operator >>(int near&) in module mytest.cpp
  49.  
  50.  
  51. I guess I didn't link the project with I/O library. But I don't know how to 
  52. do that. Can anybody give me  a pointer?
  53.  
  54. Any help is greatly appreciated.
  55.  
  56. Haizhou  Chen.
  57.  
  58. hachen@cs.umn.edu
  59.